|
ARD2
1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
|
Abstraction layer to be used for MPC5604P in an airbag. Upper layers shall make requests through this file to avoid dependencies in the application. More...
#include "derivative.h"#include "Compile_Options.h"#include "ADC.h"#include "CRC.h"#include "DSPI.h"#include "EDMA.h"#include "FCU.h"#include "LIN_UART.h"#include "ME.h"#include "PIT.h"#include "SIU.h"#include "SWT.h"#include "CGM.h"#include "CG147.h"#include "HAL.h"#include "IntcInterrupts.h"#include "Exceptions.h"#include "Maildelivery.h"#include "MailScheduler.h"Functions | |
| uint8_t | u8fnMCUInit (void) |
| Top-level initialization for Pictus. Takes care of all pins, peripherals, etc. | |
| uint8_t | u8fnInitPeripherals (void) |
| Installs power-mode configurations for all peripherals, and then configures each peripheral for a particular power-mode as described in tISRConfig. | |
| void | vfnInitInterrupts (void) |
| This function will route interrupt vectors to their routines as described by tISRConfig. It shall be called at startup and never again. | |
| void | vfnInitDSPI (void) |
| This function will configure all DSPIs according to existing config tables u8fnConfigDSPIGeneral & cau32DefaultDSPIPresetConfig. | |
| void | vfnInitADC (void) |
| This function will configure ADC0 for continuous conversions and will start it. It will run in parallel to the core after calling this routine. | |
| void | vfnInitSCI (void) |
| This function will configure all SCIs according to existing config table cau32DefaultLINUARTConfig. | |
| void | vfnOutputPinInit (void) |
| Will place output pins either in a high or low state according to a default table. | |
| void | vfnInputPadInit (void) |
| Will route inputs to the correct modules using pre-established table. | |
| void | vfnInitDMAMux (uint8_t *pu8DMAMuxSettings, uint8_t u8Size) |
| Initializes DMAMux. | |
| uint8_t | u8fnDelay (const uint32_t cu32TimeBase, uint16_t u16Cycles) |
| This function uses PIT to create a delay. It responds to the following formula: delay = (Fbus / u32TimeBase) * u16Cycles. | |
| uint8_t | u8fnRawADCToDegreesCelsius (const uint16_t u16RawCounts) |
| Converts Raw ADC counts to equivalent degrees celsius. | |
| uint8_t | u8fnRawADCToOutput (const uint16_t u16RawCounts) |
| Converts Raw ADC counts to equivalent voltage * 10. | |
| void | vfnLaunchFCU (void) |
| Launches the fault collection unit with configuration described by cau32FCUConfig. | |
| uint8_t | u8fnInitPostalService (const uint8_t cu8Enable) |
| Calls all init functions to have a working messaging system. | |
| uint8_t | u8fnLaunchScheduler (const uint8_t cu8Enable) |
| Launches scheduler using DSPI0 as instance. | |
| void | vfnTransferADCResults (uint8_t u8Instance, uint16_t *pu16Destination, uint16_t u16Size) |
| Configures a dedicated DMA channel to transfer ongoing ADC conversions to a particular memory location. | |
| void | vfnEnterLowPowerMode (void) |
| Takes the system into a non-operational low power mode. | |
Variables | |
| const uint32_t | cau32ADCConfig [] |
| const uint32_t | cau32FCUConfig [] |
Abstraction layer to be used for MPC5604P in an airbag. Upper layers shall make requests through this file to avoid dependencies in the application.
Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary
History:
| uint8_t u8fnDelay | ( | const uint32_t | cu32TimeBase, |
| uint16_t | u16Cycles | ||
| ) |
This function uses PIT to create a delay. It responds to the following formula: delay = (Fbus / u32TimeBase) * u16Cycles.
| cu32TimeBase,: | divisor of clock |
| u16Cycles,: | Multiplier. |
| uint8_t u8fnInitPeripherals | ( | void | ) |
Installs power-mode configurations for all peripherals, and then configures each peripheral for a particular power-mode as described in tISRConfig.
| None. |
| uint8_t u8fnInitPostalService | ( | const uint8_t | cu8Enable | ) |
Calls all init functions to have a working messaging system.
| cu8Enable,: | If non-zero, it will initialize the messaging system, including connections to SPI. If zero, it will disable the messaging system, disconnecting the DMA service from SPI and restoring its typical capability. |
| uint8_t u8fnLaunchScheduler | ( | const uint8_t | cu8Enable | ) |
Launches scheduler using DSPI0 as instance.
| cu8Enable,: | If non-zero, launches the scheduler, otherwise stops it. |
| uint8_t u8fnMCUInit | ( | void | ) |
Top-level initialization for Pictus. Takes care of all pins, peripherals, etc.
| None. |
| uint8_t u8fnRawADCToDegreesCelsius | ( | const uint16_t | u16RawCounts | ) |
Converts Raw ADC counts to equivalent degrees celsius.
| u16RawCounts,: | 10-bit raw ADC count for temperature. u8Temp: Temperature rounded up to closest degree celsius. |
| uint8_t u8fnRawADCToOutput | ( | const uint16_t | u16RawCounts | ) |
Converts Raw ADC counts to equivalent voltage * 10.
| u16RawCounts,: | 10-bit raw ADC counts. |
| void vfnEnterLowPowerMode | ( | void | ) |
Takes the system into a non-operational low power mode.
| None |
| void vfnInitADC | ( | void | ) |
This function will configure ADC0 for continuous conversions and will start it. It will run in parallel to the core after calling this routine.
| None. |
| void vfnInitDMAMux | ( | uint8_t * | pu8DMAMuxSettings, |
| uint8_t | u8Size | ||
| ) |
Initializes DMAMux.
| pu8DMAMuxSettings,: | Pointer to DMA settings |
| u8Size,: | Size of table |
| void vfnInitDSPI | ( | void | ) |
This function will configure all DSPIs according to existing config tables u8fnConfigDSPIGeneral & cau32DefaultDSPIPresetConfig.
| None. |
| void vfnInitInterrupts | ( | void | ) |
This function will route interrupt vectors to their routines as described by tISRConfig. It shall be called at startup and never again.
| None. |
| void vfnInitSCI | ( | void | ) |
This function will configure all SCIs according to existing config table cau32DefaultLINUARTConfig.
| None. |
| void vfnInputPadInit | ( | void | ) |
Will route inputs to the correct modules using pre-established table.
| None. |
| void vfnLaunchFCU | ( | void | ) |
Launches the fault collection unit with configuration described by cau32FCUConfig.
| None. |
| void vfnOutputPinInit | ( | void | ) |
Will place output pins either in a high or low state according to a default table.
| None. |
| void vfnTransferADCResults | ( | uint8_t | u8Instance, |
| uint16_t * | pu16Destination, | ||
| uint16_t | u16Size | ||
| ) |
Configures a dedicated DMA channel to transfer ongoing ADC conversions to a particular memory location.
| u8Instance,: | 0 or 1, depending on which ADC instance needs to be read. |
| pu16Destination,: | pointer to location where the results shall be placed. |
| u16Size,: | Amount of ADC readings to transfer. |
| const uint32_t cau32ADCConfig[] |
{
(ADC_DATA_CAN_BE_OVERWRITTEN | ADC_DATA_IS_ALIGNED_RIGHT
| ADC_IS_IN_SCAN_MODE | ADC_CTU_IS_OFF | ADC_AUTOCLOCK_OFF_EN
| ADC_EO_CTU_CONV_ISR_DIS | ADC_EO_INJ_CHAN_CONV_ISR_DIS
| ADC_EO_INJ_CHAIN_CONV_ISR_DIS | ADC_EO_CHAN_CONV_ISR_DIS
| ADC_EO_CHAIN_CONV_ISR_DIS | ADC_DMA_CLEARED_ON_ACK | ADC_DMA_EN
| ADC_IS_CLOCKING_HALF_SPEED | ADC_PR_LSB_NO_ROUNDING
| ADC_LOW_SPEED_CONFIG),
(ADC_DATA_CAN_BE_OVERWRITTEN | ADC_DATA_IS_ALIGNED_RIGHT
| ADC_IS_IN_SCAN_MODE | ADC_CTU_IS_OFF | ADC_AUTOCLOCK_OFF_EN
| ADC_EO_CTU_CONV_ISR_DIS | ADC_EO_INJ_CHAN_CONV_ISR_DIS
| ADC_EO_INJ_CHAIN_CONV_ISR_DIS | ADC_EO_CHAN_CONV_ISR_DIS
| ADC_EO_CHAIN_CONV_ISR_DIS | ADC_DMA_CLEARED_ON_ACK | ADC_DMA_DIS
| ADC_IS_CLOCKING_HALF_SPEED | ADC_PR_LSB_NO_ROUNDING
| ADC_LOW_SPEED_CONFIG) }
Default ADC configuration per instance set at startup
| const uint32_t cau32FCUConfig[] |
{
FCU_TIMEOUT(FCU_4MS_TIMEOUT),
(FCU_TES0_ENABLED | FCU_TES1_ENABLED | FCU_TES2_ENABLED | FCU_TES3_ENABLED
| FCU_TES4_ENABLED | FCU_ESF0_ENABLED | FCU_ESF1_ENABLED | FCU_ESF2_ENABLED
| FCU_ESF3_ENABLED | FCU_ESF4_ENABLED |
FCU_ENABLE_CH(FCU_CORE_CHECKSTOP_MODE_ENTERED | FCU_CORE_RESET |
FCU_LOSS_OF_XTAL | FCU_LOSS_OF_PLL0_LOCK |
FCU_FREQ0_OUT_OF_RANGE | FCU_LOSS_OF_PLL1_LOCK |
FCU_FREQ1_OUT_OF_RANGE | FCU_FLASH_FATAL_ERROR |
FCU_WATCHDOG_RESET | FCU_JTAG_RESET | FCU_POWER_COMPARATOR_ERROR
| FCU_LVD_4_5 | FCU_LVD_2_7_VREG | FCU_LVD_2_7_FLASH |
FCU_LVD_2_7_I_0 | FCU_LVD_1_2_DIG)),
(FCU_TIMEOUT_CH(FCU_CORE_CHECKSTOP_MODE_ENTERED |
FCU_LOSS_OF_XTAL | FCU_LOSS_OF_PLL0_LOCK |
FCU_FREQ0_OUT_OF_RANGE | FCU_LOSS_OF_PLL1_LOCK |
FCU_FREQ1_OUT_OF_RANGE | FCU_FLASH_FATAL_ERROR |
FCU_POWER_COMPARATOR_ERROR
| FCU_LVD_4_5 | FCU_LVD_2_7_VREG | FCU_LVD_2_7_FLASH |
FCU_LVD_2_7_I_0 | FCU_LVD_1_2_DIG) | FCU_NO_TEST_MODE |
FCU_OUTPUT0_INV_POL | FCU_OUTPUT_IS_TIME_SWITCH |
FCU_OUTPUT_FREQ(7u))
}
This variable contains the settings used for the fault collection unit